<?php
include_once('common/header.php');	
if(!isset($_SERVER['HTTP_REFERER'])) {	
	$arrJson = array('error'=>1,'msg'=>$arrError[1]);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
	exit();
} 
$intAct				= $objRequest->getParam('act', 0);
if(!isset($intAct) || $intAct == 0 ) {
	$intUserId		= $objRequest->getParam('uid',0);
	include_once('fullhouse/box-photo-detail.php');
	$objView 		= Zend_Registry::get('objView');
	$strData		= $objView->fetch('fullhouse/box-photo-detail.tpl');
	$arrJson 		= array('error'=>0,'msg'=>$strData);
}elseif($intAct == 1) {
	$intImageId	= $objRequest->getParam('imageid',0);
	$intLike	= 0;
	$objPhoto	= new Photo();
	$intError	= $objPhoto->addLike($AppUI->id,$intImageId,$intLike);
	if($intError == 0) {
		$strMessage	= $arrMessage[7];
	}
	else {
		$strMessage	= $arrError[$intError+13];
	}
	$arrJson	= array('error'=>$intError,'msg'=>$strMessage,'like'=>Vfriend_Function::numberFormat($intLike));
}elseif($intAct == 2) {
	$intImgId		= $objRequest->getParam('imgid',0);
	$intUserId		= $AppUI->id;
	$objPhoto		= new Photo();
	$intError		= $objPhoto->delete($intUserId, $intImgId);
	if($intError == 0) {
		$strMessage	= $arrMessage[8];		
	} else {
		$strMessage		= $arrError[17];
	}
	include_once('fullhouse/box-photo-detail.php');
	$objView 		= Zend_Registry::get('objView');
	$strData		= $objView->fetch('fullhouse/box-photo-detail.tpl');
	$strLink	 	= Vfriend_Function::linkFullhouseForPhoto($AppUI->username,$AppUI->hex);
	$arrJson 		= array('error'=>$intError,'msg'=>$arrMessage[8],'data'=>$strData,'page'=>$intPageA,'total'=>$intTotalA,'link'=>$strLink);
}elseif($intAct == 3) {
	$intAlbumId		= $objRequest->getParam('albumid',0);
	$objPhoto		= new Photo();
	$this->view->arrAlbum	= $objPhoto->getAlbumInfo($intAlbumId);
	$this->view->arrPerm	= $arrAlbumPerm;
	$objView 		= Zend_Registry::get('objView');
	$strData		= $objView->fetch('ajax/ui-album-edit.tpl');
	$arrJson 		= array('error'=>0,'msg'=>$strData);
}
echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
exit();
?>